# -*- coding = utf-8 -*-
# @Time : 2023/3/12 11:20
# @Author : 龙王赘婿_彪少
# @File : mytest.py
# @Software: PyCharm

# 功能：

import struct
import binascii

if __name__ == "__main__":
    buf = 14
    bufpack = struct.pack('<B', buf)

    # bytes只能调其成员函数hex，不能调用系统默认hex
    # 返回str
    bufpackhex = bufpack.hex()

    # 返回byte
    bufbinascii = binascii.b2a_hex(bufpack)

    print(buf, bufpack, bufpackhex, bufbinascii)
